package com.aidong.myprofile.action;

import java.net.URLDecoder;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.json.annotations.JSON;
import org.springframework.beans.factory.annotation.Autowired;

import com.aidong.activity.biz.MstCampaignBiz;
import com.aidong.activity.entity.MemberSportTags;
import com.aidong.login.biz.MemberLocationReportBiz;
import com.aidong.myprofile.biz.MyAidongTimeBiz;
import com.aidong.myprofile.biz.MyPersonalMsgBiz;
import com.aidong.myprofile.entity.HailFellowMsg;
import com.aidong.myprofile.entity.MemberCharmPart;
import com.aidong.myprofile.entity.MyPersonalMsg;
import com.aidong.util.MyPersonalInfoUtil;
import com.aidong.util.ReadPropertiesUtil;
import com.opensymphony.xwork2.ModelDriven;

/**
 * 我的个人信息
 * @author java
 * @version 1.0    
 *  2015.07.05
 */
@ParentPackage("json")
@Namespace("/")
public class MyPersonalMsgAction implements ModelDriven<MyPersonalMsg> {
	
	private MyPersonalMsg personalMsg;
	private String accountId;
	private String accountName;
	private int accounttype;
	private String idongIdOther;
	private int mobileExists;
	
	@Override
	public MyPersonalMsg getModel() {
		if(personalMsg == null){
			personalMsg = new MyPersonalMsg();
		}
		return personalMsg;
	}
	

	public void setAccountId(String accountId) {
		this.accountId = accountId;
	}

	public void setAccountName(String accountName) {
		this.accountName = accountName;
	}

	public void setAccounttype(int accounttype) {
		this.accounttype = accounttype;
	}


	public void setIdongIdOther(String idongIdOther) {
		this.idongIdOther = idongIdOther;
	}


	public void setMobileExists(int mobileExists) {
		this.mobileExists = mobileExists;
	}


	private Map<String, Object> map;
	
	@JSON
	public Map<String, Object> getMap() {
		return map;
	}

	private MyPersonalMsgBiz personalMsgBiz; // 个人信息service
	
	private MstCampaignBiz mstCampaignBiz;
	
	private MyAidongTimeBiz aidongTimeBiz;
	
	/*private MemberLocationReportBiz locationReportBiz;
	
	@Autowired
	public void setLocationReportBiz(MemberLocationReportBiz locationReportBiz) {
		this.locationReportBiz = locationReportBiz;
	}*/

	/**
	 * 个人信息service
	 * @param personalMsgBiz
	 */
	@Autowired
	public void setPersonalMsgBiz(MyPersonalMsgBiz personalMsgBiz) {
		this.personalMsgBiz = personalMsgBiz;
	}
	
	@Autowired
	public void setMstCampaignBiz(MstCampaignBiz mstCampaignBiz) {
		this.mstCampaignBiz = mstCampaignBiz;
	}

	public void setAidongTimeBiz(MyAidongTimeBiz aidongTimeBiz) {
		this.aidongTimeBiz = aidongTimeBiz;
	}

	/**
	 * 我的个人信息
	 * @return
	 */
	@Action(value="getpersonalmsg",results={@Result(name="succ",type="json",params={"root","map"})})
	public String getPersonalMsg(){
		/*try {
			String idongId = personalMsg.getIdongId();
			
			String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
			String hour = new SimpleDateFormat("HH").format(new Date());
			
			// 记录用户活跃度
			if(!"".equals(idongId) && null != idongId) {
				// 是否在当天某时已有记录
				Map<String, Object> memberMap = new HashMap<String, Object>();
				memberMap.put("date", date);
				memberMap.put("menuType", 5);
				memberMap.put("idongId", idongId);
				Map<String, Object> userCountMap = locationReportBiz.getFunctionUseCount(memberMap);
				if(userCountMap != null){
					// 修改用户活跃数 
					int userCount = Integer.parseInt(userCountMap.get("count") + "");
					userCountMap.put("liveCount", userCount + 1);
					locationReportBiz.editFunctionUseCount(userCountMap);
				}else{
					// 记录用户活跃数
					memberMap.put("liveCount", 1);
					memberMap.put("liveType", 2);
					locationReportBiz.addFunctionUseLiveness(memberMap);
				}
			}
			// 是否在当天某时已有记录
			Map<String, Object> useMap = new HashMap<String, Object>();
			useMap.put("date", date);
			useMap.put("menuType", 5);
			useMap.put("hour", hour);
			Map<String, Object> countMap = locationReportBiz.getFunctionUseCount(useMap);
			if(countMap != null){
				// 修改使用活跃数
				int recordCount = Integer.parseInt(countMap.get("count") + "");
				useMap.put("liveCount", recordCount + 1);
				locationReportBiz.editFunctionUseCount(useMap);
			}else{
				// 记录使用活跃度
				useMap.put("liveCount", 1);
				useMap.put("liveType", 1);
				locationReportBiz.addFunctionUseLiveness(useMap);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}*/
		
		map = new HashMap<String, Object>();
		try {
			String idongId = personalMsg.getIdongId(); // 爱动号
			if(!"".equals(idongId) && idongId != null){
				Map<String, Object> taskTags = personalMsgBiz.selectTaskTags(Integer.parseInt(idongId));
				MyPersonalMsg peresonals = personalMsgBiz.getPersonalMsg(idongId);
				if(peresonals != null){
					peresonals.setTask1(Integer.parseInt(taskTags.get("task1").toString()));
					peresonals.setTask2(Integer.parseInt(taskTags.get("task2").toString()));
					peresonals.setTask3(Integer.parseInt(taskTags.get("task3").toString()));
					peresonals.setNickName(URLDecoder.decode(peresonals.getNickName()));
					String url = peresonals.getHeadUrl();
					if(!"".equals(url) && null != url){
						peresonals.setHeadUrl(ReadPropertiesUtil.getIMGREAD(url));
					}else{
						peresonals.setHeadUrl("");
					}
					List<MemberSportTags> tags = peresonals.getSportTags();
					for (MemberSportTags tag : tags) {
						tag.setSportTagsUrl(ReadPropertiesUtil.getIMGREAD(tag.getSportTagsUrl()));
					}
					
					String birthday = peresonals.getBirthday(); // 出生日期
					if(!"".equals(birthday) && birthday != null){
						String birth[] = birthday.split("-");
						String constellation = MyPersonalInfoUtil.getConstellation(Integer.parseInt(birth[1]), Integer.parseInt(birth[2]));
						peresonals.setConstellation(constellation);// 星座
						int age = MyPersonalInfoUtil.getAgeByBirthday(birthday);
						peresonals.setAge(age); // 年龄
					}
					
					int weight = peresonals.getWeight(); // 体重(KG)
					int height = peresonals.getHeight(); // 身高(CM)
					if(weight > 0 && height > 0){
						double BMI = weight / ((height/100.00) * (height/100.00));
						DecimalFormat df = new DecimalFormat("0.0");
						String result = df.format(BMI);
						peresonals.setBMI(Double.parseDouble(result)); // BMI
						String BMILevel = ""; // BMI指数
						if(BMI < 18.5){ 
							BMILevel = "偏瘦";
						}else if(BMI > 18.5 && BMI < 24){
							BMILevel = "正常";
						}else if(BMI > 24 && BMI < 27){
							BMILevel = "偏胖";
						}else if(BMI > 27 && BMI < 30){
							BMILevel = "肥胖";
						}else if(BMI > 30){
							BMILevel = "重度肥胖";
						}
						peresonals.setBMILevel(BMILevel);
					}
					// 魅力部位
					List<MemberCharmPart> charmParts = peresonals.getCharmParts();
					String charmPart = "";
					if(charmParts.size() > 0){
						for (MemberCharmPart part : charmParts) {
							charmPart += part.getPartName() + "   ";
						}
					}
					peresonals.setCharmPart(charmPart);
					peresonals.setCharmParts(new ArrayList<MemberCharmPart>());
					//peresonals.setQqNumber(qqNumber);
					if (peresonals.getQqNumber() == null) {
						peresonals.setQqNumber("");
					}
					if (peresonals.getWeiBo() == null) {
						peresonals.setWeiBo("");
					}
					if (peresonals.getWeChat() == null) {
						peresonals.setWeChat("");
					}
					if (peresonals.getQqNumberName() == null) {
						peresonals.setQqNumberName("");
					}
					if (peresonals.getWeiBoName() == null) {
						peresonals.setWeiBoName("");
					}
					if (peresonals.getWeChatName() == null) {
						peresonals.setWeChatName("");
					}
				}else{
					map.put("code", 0);
					map.put("msg", "用户不存在");
					return "succ";
				}
				
				int aidongId = Integer.parseInt(idongId);
				
				Map<String, Object> unreadMap = personalMsgBiz.getMessageUnreadCount(aidongId);
				// 私信未读
				int letterCount = Integer.parseInt(unreadMap.get("letterCount").toString());
				// 系统消息未读
				int sysCount = Integer.parseInt(unreadMap.get("sysCount").toString());
				
				// 预约成功条数
				Map<String, Object> appointCount = personalMsgBiz.getAppointmentCount(aidongId);
				int storeCount = Integer.parseInt(appointCount.get("storeCount").toString());
				int subCount = Integer.parseInt(appointCount.get("subCount").toString());
				int ptCount = Integer.parseInt(appointCount.get("ptCount").toString());
				int signCount = Integer.parseInt(appointCount.get("signCount").toString());
				
				// 我关注的人数
				int attentionCount = personalMsgBiz.getMyAttentionCount(aidongId);
				// 我的粉丝人数
				int fansCount = personalMsgBiz.getMyFansCount(aidongId);
				
				//预约的场馆，私教，课程，活动
				Map<String,Object> msp=new HashMap<String,Object>();
				msp.put("idongId", idongId);
				msp.put("isOr", "0");
				int subCou=personalMsgBiz.selectMySubBan(msp);
				subCou+=personalMsgBiz.selectMySubAct(msp);
				subCou+=personalMsgBiz.selectMySubCam(msp);
				subCou+=personalMsgBiz.selectMySubCoach(msp);
				//获取订单数量，营养品，餐饮，装备，赛事
				int ordCou=personalMsgBiz.selectMyOrderCou(msp);
				msp.put("isOr", "1");
				//预约的场馆，私教，课程，活动  (预约时间为今日并且已支付未核销的)
				int subUnCou=personalMsgBiz.selectMySubBan(msp);
				subUnCou+=personalMsgBiz.selectMySubAct(msp);
				subUnCou+=personalMsgBiz.selectMySubCam(msp);
				subUnCou+=personalMsgBiz.selectMySubCoach(msp);
				//获取订单数量，营养品，餐饮，装备，赛事 (待支付订单)
				int ordUnCou=personalMsgBiz.selectMyOrderCou(msp);
				
				map.put("code", 1);
				map.put("unreadCount", letterCount + sysCount);
				map.put("appointCount", storeCount + subCount + ptCount + signCount);
				map.put("storeCount", storeCount);
				map.put("subCount", subCount);
				map.put("ptCount", ptCount);
				map.put("signCount", signCount);
				map.put("attentionCount", attentionCount);
				map.put("fansCount", fansCount);
				map.put("result", peresonals);
				map.put("ordCou", ordCou);
				map.put("subCou", subCou);
				map.put("subUnCou", subUnCou);
				map.put("ordUnCou", ordUnCou);
				return "succ";
			}else{
				map.put("code", 0);
				map.put("msg", "参数缺失");
				return "succ";
			}
		} catch (Exception e) {
			e.printStackTrace();
			map.put("code", 0);
			map.put("msg", "系统异常");
			return "succ";
		}
	}
	
	/**
	 * 查看好友信息
	 * @return
	 */
	@Action(value="gethailfellomsg",results={@Result(name="succ",type="json",params={"root","map"})})
	public String getHailFellowMsg(){
		map = new HashMap<String, Object>();
		try {
			String idongId = personalMsg.getIdongId(); // 好友爱动号
			String myIdongId = personalMsg.getMyIdongId(); // 我的爱动号
 			if(!"".equals(idongId) && idongId != null){
 				if (!idongId.equals(myIdongId)) {
					//资料被查看热度+1
				}
				// 好友关注的人数
				int attentionCount = personalMsgBiz.getMyAttentionCount(Integer.parseInt(idongId));
				// 好友的粉丝人数
				int fansCount = personalMsgBiz.getMyFansCount(Integer.parseInt(idongId));
				
				// 最近的爱动时刻
				List<Map<String, Object>> times = aidongTimeBiz.getHailAidongTime(Integer.parseInt(idongId));
				for (Map<String, Object> time : times) {
					time.put("picUrl", ReadPropertiesUtil.getIMGREAD(time.get("picUrl")));
				}
				// 好友信息
				HailFellowMsg fellowMsg = personalMsgBiz.getHailFellowMsg(Integer.parseInt(idongId));
				
				if(fellowMsg != null){
					List<MemberSportTags> tags = fellowMsg.getSportTags();
					for (MemberSportTags tag : tags) {
						tag.setSportTagsUrl(ReadPropertiesUtil.getIMGREAD(tag.getSportTagsUrl()));
					}
					
					String headUrl = fellowMsg.getHeadUrl(); // 头像URL
					if(!"".equals(headUrl) && headUrl != null){
						fellowMsg.setHeadUrl(ReadPropertiesUtil.getIMGREAD(fellowMsg.getHeadUrl()));
					}else{
						fellowMsg.setHeadUrl("");
					}
					
					fellowMsg.setAttionCount(attentionCount);
					fellowMsg.setFansCount(fansCount);
					fellowMsg.setTimes(times);
					
					String birthday = fellowMsg.getBirthday(); // 出生日期
					if(!"".equals(birthday) && birthday != null){
						String birth[] = birthday.split("-");
						String constellation = MyPersonalInfoUtil.getConstellation(Integer.parseInt(birth[1]), Integer.parseInt(birth[2]));
						fellowMsg.setConstellation(constellation);// 星座
						int age = MyPersonalInfoUtil.getAgeByBirthday(birthday);
						fellowMsg.setAge(age); // 年龄
					}
					
					// 魅力部位
					List<MemberCharmPart> charmParts = fellowMsg.getCharmParts();
					String charmPart = "";
					if(charmParts != null && charmParts.size() > 0){
						for (MemberCharmPart part : charmParts) {
							charmPart += part.getPartName() + "   ";
						}
					}
					fellowMsg.setCharmPart(charmPart);
					fellowMsg.setCharmParts(new ArrayList<MemberCharmPart>());
				}else{
					map.put("result", new HailFellowMsg());
				}
				
				int weight = fellowMsg.getWeight(); // 体重(KG)
				int height = fellowMsg.getHeight(); // 身高(CM)
				if(weight > 0 && height > 0){
					double BMI = weight / ((height/100.00) * (height/100.00));
					DecimalFormat df = new DecimalFormat("0.0");
					String result = df.format(BMI);
					fellowMsg.setBMI(Double.parseDouble(result)); // BMI
					String BMILevel = null; // BMI指数
					if(BMI < 18.5){ 
						BMILevel = "偏瘦";
					}else if(BMI > 18.5 && BMI < 24){
						BMILevel = "正常";
					}else if(BMI > 24 && BMI < 27){
						BMILevel = "偏胖";
					}else if(BMI > 27 && BMI < 30){
						BMILevel = "肥胖";
					}else if(BMI > 30){
						BMILevel = "重度肥胖";
					}
					fellowMsg.setBMILevel(BMILevel);
				}
				
				// 关注状态
				Map<String, Object> paraMap = new HashMap<String, Object>();
				paraMap.put("idongId", myIdongId); // 关注人
				paraMap.put("tionIdongId", idongId); // 被关注人
				int attionCount = mstCampaignBiz.getIfAttention(paraMap);
				if(!"".equals(myIdongId) && myIdongId != null){
					if(attionCount > 0){ // 已关注
						fellowMsg.setAttionStatus("1");
					}else{ // 关注
						fellowMsg.setAttionStatus("2");
					}
				}else{ // 关注
					fellowMsg.setAttionStatus("2");
				}
				map.put("code", 1);
				map.put("result", fellowMsg);
				return "succ";
			}else{
				map.put("code", 0);
				map.put("msg", "参数缺失");
				return "succ";
			}
		} catch (Exception e) {
			e.printStackTrace();
			map.put("code", 0);
			map.put("msg", "系统异常");
			return "succ";
		}
	}
	
	/**
	 * 修改我的个人信息
	 * @return
	 */
	@Action(value="editpersonmsg",results={@Result(name="succ",type="json",params={"root","map"})})
	public String editMyPersonMsg(){
		map = new HashMap<String, Object>();
		try {
			String idongId = personalMsg.getIdongId(); // 爱动号
			if(!"".equals(idongId) && idongId != null){
				String BWH = personalMsg.getBWH(); // 三围
				if(StringUtils.isNotEmpty(BWH)){
					String arrBWH[] = BWH.split("/");
					personalMsg.setBwhBust(Integer.parseInt(arrBWH[0].toString()));
					personalMsg.setBwhWaist(Integer.parseInt(arrBWH[1].toString()));
					personalMsg.setBwhHip(Integer.valueOf(arrBWH[2].toString()));
				}
				personalMsgBiz.editMyPersonMsg(personalMsg);
				map.put("code", 1);
				map.put("result", "修改成功");
				return "succ";
			}else{
				map.put("code", 0);
				map.put("msg", "参数缺失");
				return "succ";
			}
		} catch (Exception e) {
			e.printStackTrace();
			map.put("code", 0);
			map.put("msg", "系统异常");
			return "succ";
		}
	}
	
	@Action(value="bindaccount",results={@Result(name="succ",type="json",params={"root","map"})})
	public String bindAccount() {
		String idongId = personalMsg.getIdongId();
		map = new HashMap<String, Object>();
		if(!"".equals(idongId) && null != idongId && !"".equals(accountId) && null != accountId && !"".equals(accountName) && null != accountName && accounttype != 0){
			Map<String, Object> paraMap = new HashMap<String, Object>();
			paraMap.put("idongId", idongId); 
			paraMap.put("accountName", accountName); 
			paraMap.put("accountId", accountId); 
			String s =  "'"+accountId+"'";
			System.out.println(s);
			paraMap.put("accountIdSelect", s); 
			//查询是否已绑定过
			if (accounttype == 1) {
				//QQ
				List<Map<String, Object>> resultMap = personalMsgBiz.qqAccount(paraMap);
				if (null == resultMap || resultMap.size() == 0) {
					personalMsgBiz.bindQq(paraMap);
				}else {
					//已绑定过
					if (resultMap.size() > 1) {
						map.put("code", 0);
						map.put("msg", "账号已多次绑定");
						return "succ";
					}else {
						int aidong = Integer.valueOf(resultMap.get(0).get("idongId").toString());
						map.put("code", 2);
						if ("".equals(resultMap.get(0).get("mobilePhone")) || null == resultMap.get(0).get("mobilePhone")) {
							map.put("mobilePhone", "");
							map.put("mobileExists", 1);
						}else {
							map.put("mobilePhone", resultMap.get(0).get("mobilePhone"));
							map.put("mobileExists", 2);
						}
						int dynamicCount = personalMsgBiz.selectDynamicCount(aidong);
						int messageCount = personalMsgBiz.selectMessageCount(aidong);
						map.put("dynamicCount", dynamicCount);
						map.put("messageCount", messageCount);
						map.put("idongIdOther", aidong);
						return "succ";
					}
					
				}
				
			}else if (accounttype == 2) {
				//微博
				List<Map<String, Object>> resultMap = personalMsgBiz.weiBoAccount(paraMap);
				
				if (null == resultMap || resultMap.size() == 0) {
					personalMsgBiz.bindWeiBo(paraMap);
				}else {
					//已绑定过
					if (resultMap.size() > 1) {
						map.put("code", 0);
						map.put("msg", "账号已多次绑定");
						return "succ";
					}else {
						int aidong = Integer.valueOf(resultMap.get(0).get("idongId").toString());
						map.put("code", 2);
						if ("".equals(resultMap.get(0).get("mobilePhone")) || null == resultMap.get(0).get("mobilePhone")) {
							map.put("mobilePhone", "");
							map.put("mobileExists", 1);
						}else {
							map.put("mobilePhone", resultMap.get(0).get("mobilePhone"));
							map.put("mobileExists", 2);
						}
						int dynamicCount = personalMsgBiz.selectDynamicCount(aidong);
						int messageCount = personalMsgBiz.selectMessageCount(aidong);
						map.put("dynamicCount", dynamicCount);
						map.put("messageCount", messageCount);
						map.put("idongIdOther", aidong);
						return "succ";
					}
					
				}
				
			}else {
				//微信
				List<Map<String, Object>> resultMap = personalMsgBiz.weChatAccount(paraMap);
				if (null == resultMap || resultMap.size() == 0) {
					personalMsgBiz.bindWeChat(paraMap);
				}else {//已绑定过
					if (resultMap.size() > 1) {
						map.put("code", 0);
						map.put("msg", "账号已多次绑定");
						return "succ";
					}else {
						int aidong = Integer.valueOf(resultMap.get(0).get("idongId").toString());
						map.put("code", 2);
						if ("".equals(resultMap.get(0).get("mobilePhone")) || null == resultMap.get(0).get("mobilePhone")) {
							map.put("mobilePhone", "");
							map.put("mobileExists", 1);
						}else {
							map.put("mobilePhone", resultMap.get(0).get("mobilePhone"));
							map.put("mobileExists", 2);
						}
						int dynamicCount = personalMsgBiz.selectDynamicCount(aidong);
						int messageCount = personalMsgBiz.selectMessageCount(aidong);
						map.put("dynamicCount", dynamicCount);
						map.put("messageCount", messageCount);
						map.put("idongIdOther", aidong);
						return "succ";
					}
					
					
				}
			}
			map.put("code", 1);
			map.put("msg", "绑定成功");
			return "succ";
		}else {
			map.put("code", 0);
			map.put("msg", "参数缺失");
			return "succ";
		}
	}
	
	@Action(value="confirmbindaccount",results={@Result(name="succ",type="json",params={"root","map"})})
	public String confirmBindAccount() {
		map = new HashMap<String, Object>();
		String idongId = personalMsg.getIdongId();
		if(!"".equals(idongId) && null != idongId && !"".equals(accountId) && null != accountId && !"".equals(accountName) && null != accountName && accounttype != 0 && !"".equals(idongIdOther) && null != idongIdOther&& mobileExists !=0 ){
			Map<String, Object> paraMap = new HashMap<String, Object>();
			paraMap.put("idongId", idongIdOther); 
			paraMap.put("idongId2", idongId);
			paraMap.put("accountName", accountName); 
			paraMap.put("accountId", accountId); 
			if (mobileExists == 1) {
				//未绑定-删除-会员表、动态表、消息
				//personalMsgBiz.deleteMemberNoPhone(paraMap);
				//personalMsgBiz.deleteMessageNoPhone(paraMap);
				//personalMsgBiz.deleteDynamicNoPhone(paraMap);
				if (accounttype == 1) {// QQ
					personalMsgBiz.unBindQq(paraMap);
					personalMsgBiz.bindQq2(paraMap);
				} else if (accounttype == 2) {// 微博
					personalMsgBiz.unBindWeiBo(paraMap);
					personalMsgBiz.bindWeiBo2(paraMap);
				} else {// 微信
					personalMsgBiz.unBindWeChat(paraMap);
					personalMsgBiz.bindWeChat2(paraMap);
				}
			}else {
				// 已绑定手机
				if (accounttype == 1) {// QQ
					personalMsgBiz.unBindQq(paraMap);
					personalMsgBiz.bindQq2(paraMap);
				} else if (accounttype == 2) {// 微博
					personalMsgBiz.unBindWeiBo(paraMap);
					personalMsgBiz.bindWeiBo2(paraMap);
				} else {// 微信
					personalMsgBiz.unBindWeChat(paraMap);
					personalMsgBiz.bindWeChat2(paraMap);
				}
			}
			map.put("code", 1);
			map.put("msg", "成功");
			return "succ";
		}else {
			map.put("code", 0);
			map.put("msg", "参数缺失");
			return "succ";
		}
	}
	@Action(value="removeaccount",results={@Result(name="succ",type="json",params={"root","map"})})
	public String removeAccount() {
		String idongId = personalMsg.getIdongId();
		map = new HashMap<String, Object>();
		if(!"".equals(idongId) && null != idongId && accounttype != 0){
			Map<String, Object> paraMap = new HashMap<String, Object>();
			paraMap.put("idongId", idongId); 
			if (accounttype == 1) {
				personalMsgBiz.unBindQq(paraMap);
			}else if (accounttype == 2) {
				personalMsgBiz.unBindWeiBo(paraMap);
			}else {
				personalMsgBiz.unBindWeChat(paraMap);
			}
			map.put("code", 1);
			map.put("msg", "已解除绑定");
			return "succ";
		}else {
			map.put("code", 0);
			map.put("msg", "参数缺失");
			return "succ";
		}
	
	}
}